package kassiopeia.agent.alerting;

import java.net.InetAddress;
import java.net.UnknownHostException;
import kassiopeia.agent.AgentIDHolder;
import org.springframework.stereotype.Component;

@Component
public class NodeName {

    private String nodeName;

    public NodeName() {
        try {
            this.nodeName = InetAddress.getLocalHost().getCanonicalHostName()
                    + "::" + AgentIDHolder.getThisAgentId();
        } catch (UnknownHostException ex) {
            this.nodeName = "UNKNOWN ADDRESS::" + AgentIDHolder.getThisAgentId();
        }
    }

    public String getNodeName() {
        return nodeName;
    }
}
